#include "command.hpp"

int main()
{
    int wfd = open(Path,O_WRONLY);
    if(wfd<0)
    {
        cerr<<"open error: "<<errno<<",errstring: "<<strerror(errno)<<endl;
        return -1;
    }

    //打开文件了
    string inbuffer;
    while(1)
    {
        cout<<"Please Enter Your Message: ";
        std::getline(cin,inbuffer);
        if(inbuffer=="quit")
            break;
        ssize_t n = write(wfd,inbuffer.c_str(),inbuffer.size());
        if(n<0)
        {
            cerr<<"write error: "<<errno<<",errstring: "<<strerror(errno)<<endl;
            break;
        }
        
    }

    close(wfd);
    return 0;
}